//
//  TabGridView.swift
//  BasicTools
//
//  Created by ikang on 2025/8/21.
//

import SwiftUI

struct TabGridView: View {
    @Bindable public var gridModel: TabGridModel
    
    var body: some View {
        Grid(alignment: .bottom, horizontalSpacing: 0, verticalSpacing: 0 ) { 
            GridRow { 
                ForEach(0..<gridModel.itemArr.count, id: \.self) { index in
                    @Bindable var item = gridModel.itemArr[index]
                    TabBarItem(itemModel: item, currentIndex: index)
                        .environment(gridModel)
                        .background(gridModel.gridBackgroundColor)
                }
            }
        }
        .background(gridModel.gridBackgroundColor)
        .frame(height: gridModel.gridHeight)
        .cornerRadius(gridModel.gridCornerRadius)
        .clipped()
    }
}

//#Preview {
//    GridView()
//}
